<template>
  <MainLayout />
</template>

<script lang="ts">
import { defineComponent, onMounted } from 'vue'
import MainLayout from './layout/MainLayout.vue'
import { useUserStore } from './store/user'
import { useCartStore } from './store/cart'
import { getUserInfo } from './api/auth'

export default defineComponent({
  name: 'App',
  components: {
    MainLayout
  },
  setup() {
    const userStore = useUserStore()
    const cartStore = useCartStore()

    onMounted(async () => {
      // 初始化用户状态
      userStore.initializeFromLocalStorage()
      
      // 初始化购物车状态
      cartStore.loadFromLocalStorage()
        const responseuser = await getUserInfo();
           console.log(responseuser,'responseuser');
    })
  }
})
</script>

<style>
/* 全局样式可以在这里定义，但主要样式将在styles/index.scss中定义 */
</style>